package trip;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.GenerationType;

@Entity
@Table(name = "ROUTE")
public class Route {
	@Id
	@Column(name = "id")
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private long id;

	@Column(name = "number", nullable = false)
	private Integer number;

	@Column(name = "route_name", nullable = false, length = 30)
	private String name;
	
	@Column(name = "active", nullable = false)
	private Boolean	active;

	//constructors
	public Route() {};
	
	public Route(long id, Integer number, String name, Boolean active) {
		this.id = id;
		this.number = number;
		this.name = name;
		this.active = active;
	}
	
	//id
	public long getId() {
		return id;
	}

	public Route setId(long id) {
		this.id = id;
		return this;
	}

	//number
	public Integer getNumber() {
		return number;
	}

	public Route setNumber(Integer number) {
		this.number = number;
		return this;
	}

	//name
	public String getName() {
		return name;
	}

	public Route setName(String name) {
		this.name = name;
		return this;
	}

	//active
	public Boolean getActive() {
		return active;
	}

	public Route setActive(Boolean active) {
		this.active = active;
		return this;
	}
	
	public boolean equals(Route route) {
		if (route == null)
			return false;
		if (this.id == route.id && 
			this.number == route.number && 
			this.name.equalsIgnoreCase(route.name) &&
			this.active == route.active)
			return true;
		else
			return false;
	}
}